*
* $Id$
*
* $Log: gpaset.F,v $
* Revision 1.1.1.1  2002/06/16 15:18:38  hristov
* Separate distribution  of Geant3
*
* Revision 1.2  2001/03/20 06:36:26  alibrary
* 100 parameters now allowed for geant shapes
*
* Revision 1.1.1.1  1999/05/18 15:55:17  fca
* AliRoot sources
*
* Revision 1.1.1.1  1995/10/24 10:20:46  cernlib
* Geant
*
*
#include "geant321/pilot.h"
*CMZ :  3.21/02 29/03/94  15.41.32  by  S.Giani
*-- Author :
      SUBROUTINE GPASET(PAR)
C-
C-   Created  12-JUN-1991   Nils Joar Hoimyr
C-   Modified 21.02.1992  Jouko Vuoskoski
C-
C-  Calculates the coordinates of the corner points of a GEANT PARA  shape
C-  from the shape parameters.   The end faces are generated by drawing
C-  connected polylines between the corner points at each Z-end of the shape.
C-  A ruled solid is then defined between the 2 faces, and written out in SET.
C---------------------------------------------------------
C
#include "geant321/gcsetf.inc"
 
C
      DIMENSION PAR(100)
      REAL P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z,P4X,P4Y,P4Z
      REAL P5X,P5Y,P5Z,P6X,P6Y,P6Z,P7X,P7Y,P7Z,P8X,P8Y,P8Z
 
C
C----------------------------------------------------------------------
C
      DX=PAR(1)
      DY=PAR(2)
      DZ=PAR(3)
      TXY=PAR(4)
      TXZ=PAR(5)
      TYZ=PAR(6)
C       Calculation of corner points (verify PHI/THETA coordinates,
C       I.e. TXZ AND TYZ should possibly change place)
C
C       FACE 1:
      P1X= -DX*COS(TYZ)-DY*SIN(TXY)
      P1Y= -DY*COS(TXY)
      P1Z= -DZ*COS(TXZ)-DY*SIN(TXY)
C
      P2X= DX*COS(TYZ)-DY*SIN(TXY)
      P2Y= -DY*COS(TXY)
      P2Z= -DZ*COS(TXZ)-DY*SIN(TXY)
C
      P3X= DX*COS(TYZ)-DY*SIN(TXY)
      P3Y= DY*COS(TXY)
      P3Z= -DZ*COS(TXZ)+DY*SIN(TXY)
C
      P4X= DX*COS(TYZ)-DY*SIN(TXY)
      P4Y= DY*COS(TXY)
      P4Z= -DZ*COS(TXZ)+DY*SIN(TXY)
C
C      FACE 2:
C
      P5X= -DX*COS(TYZ)+DY*SIN(TXY)
      P5Y= -DY*COS(TXY)
      P5Z= DZ*COS(TXZ)-DY*SIN(TXY)
C
      P6X= DX*COS(TYZ)+DY*SIN(TXY)
      P6Y= -DY*COS(TXY)
      P6Z= DZ*COS(TXZ)-DY*SIN(TXY)
C
      P7X= DX*COS(TYZ)+DY*SIN(TXY)
      P7Y= DY*COS(TXY)
      P7Z= DZ*COS(TXZ)+DY*SIN(TXY)
C
      P8X= -DX*COS(TYZ)+DY*SIN(TXY)
      P8Y= DY*COS(TXY)
      P8Z= DZ*COS(TXZ)+DY*SIN(TXY)
C
C       DESCRIBED BY 2 FACES represented by polylines
C       connected by the corners of the shape.
C *WRITE SET@103,F1#3,3,2,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z,P4X,P4Y,P4Z
C *WRITE SET@103,F2#3,3,2,P5X,P5Y,P5Z,P6X,P6Y,P6Z,P7X,P7Y,P7Z,P8X,P8Y,P8Z
C *WRITE SET @100,N#145,!F1,!F2
C
C----------------------------------------------------------------------
C
      WRITE(BLKSTR,10000)N1,P1X,P1Y,P1Z,P2X,P2Y,P2Z, P3X,P3Y,P3Z,P4X,
     +P4Y,P4Z
      CALL GJWRIT
      N1=N1+1
      WRITE(BLKSTR,10000)N1,P5X,P5Y,P5Z,P6X,P6Y,P6Z, P7X,P7Y,P7Z,P8X,
     +P8Y,P8Z
      CALL GJWRIT
      N1=N1+1
      WRITE(BLKSTR,10100)N1,N1-2,N1-1
      CALL GJWRIT
C
10000   FORMAT('@103,',I10,',:5,2#3,3,2,',G14.7,',',G14.7,','
     +  ,G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7,','
     +  ,G14.7,',',G14.7,',',G14.7,',',G14.7,',',G14.7)
10100   FORMAT('@100,',I10,',:5,2#145,!',I10,',!',I10)
C
      END
